{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
    <div class="panel panel-info">
        <div class="panel-heading">当前数量： {$total}</div>
        <div class="panel-body">
            <form id = "myform" action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{$_P['m']}" />
                <input type="hidden" name="type" value="{$type}" />
                <input type="hidden" name="uid" value="{$uid}" />
                <input type="hidden" name="do" id="do" value="fanslog" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">操作</label>
                    {if $types_data && is_array($types_data)}
                    <div class="col-sm-9 col-lg-9 col-md-9 col-xs-9">
                        <div class="btn-group">
                            {loop $types_data $row}
                            <a href="{php echo filter_url('type:'.$row['type']);}"
                                       class="btn {if $type == $row['type']}btn-primary{else}btn-default{/if}">
                                {php echo $row['name'];}<span style="color: #ff0000">{php echo $row['num'];}</span></a>
                            {/loop}
                        </div>
                    </div>
                    {/if}
                    {if count($themelist)>1 }
                    <div class="col-xs-12 col-sm-2 col-md-2">
                        <select onchange="submitForm();" class="form-control" name="themeid">
                            {loop $themelist $row}
                            <option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
                            {/loop}
                        </select>
                    </div>
                    {else}
                    <input type="hidden" name="themeid" value="{$themeid}" />
                    {/if}
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">{$is_special_mode}</label>
                    {if $type_arr}
                    <div class="col-sm-9 col-lg-9 col-md-9 col-xs-9">
                        <div class="btn-group">
                            {loop $type_arr $row}
                            <a href="{php echo filter_url('click_open_box:'.$row['click_open_box']);}" class="btn {if $click_open_box == $row['click_open_box']}btn-primary{else}btn-default{/if}">
                                {php echo $row['title'];}<span style="color: #ff0000">{php echo $row['total'];}</span></a>
                            {/loop}
                        </div>
                    </div>
                    {/if}
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">用户信息</label>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <input class="form-control" name="keyword" placeholder="输入昵称/姓名名或手机号" type="text" value="{$_P['keyword']}">
                    </div>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-3">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                        <input type="hidden" name="__token__" value="{$Request.token}"/>
                        <input class="btn btn-default" type="submit" name="export_submit" onclick="jump()" id="export_submit" value="导出EXCEL">
                    </div>
                    {if $uid}
                        <div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
                            <a class="btn btn-default" href="{php echo createWebUrl('fanslog', array('op' => 'display','themeid'=>$themeid, 'uid' => 0));}" title="用户日志">所有日志</a>
                        </div>
                    {/if}
                </div>
            </form>
        </div>
    </div>

    <div class="tab-content">
        <div class="panel panel-default">
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                        <tr>
                            <th style="width: 60px">UID</th>
                            <th style="width: 100px">昵称</th>
                            <th style="width: 100px">姓名/电话</th>
                            <th style="width: 100px">上级</th>
                            <th style="width: 180px">操作</th>
                            <th style="width: 60px">次数</th>
                            <th style="width: 80px">来源</th>
                            <th style="width: 70px">状态</th>
                            <th style="width: 100px">员工</th>
                            <th style="width: 70px">时间</th>
                            {if $_G['isSuperAdmin']}
                            <th style="width: 90px;text-align: right">操作</th>
                            {/if}
                        </tr>
                    </thead>
                    <tbody>
                    {loop $list $index $item}
                    <tr>
                        <td>{$item['uid']}<br>
                        <td>
                            <a href="{php echo createWebUrl('fanslog', array('op' => 'display','themeid'=>$themeid, 'uid' => $item['uid']));}">
                                <img src="{php echo tomedia($item['user_avater']);}" width="28" style="border-radius: 3px;"><br>
                                {$item['user_nickname']}
                            </a>
                        </td>
                        <td>{$item['user_username']}<br>
                            <small>{$item['user_mobile']}</small>
                        </td>

                        <td>
                            {if $item['fromuser_nickname'] }
                            <a href="{php echo createWebUrl('fanslog', array('op' => 'display','themeid'=>$themeid, 'uid' => $item['from_uid']));}">
                                <img src="{php echo tomedia($item['fromuser_avater']);}" width="28" style="border-radius: 3px;"><br>
                                {$item['fromuser_nickname']}
                            </a>
                            {else}
                            无
                            {/if}
                        </td>
                        <td>
                            {if $item['type'] ==1}
                                <span class="label label-info"> {$item['type_name']} {php echo $item['standing_time']>0?'【 '.$item['standing_time'].'秒】':'';} </span>
                            {elseif $item['type']>=2&&$item['type']<=4}
                                <span class="label label-danger"> {$item['type_name']}</span>
                            {elseif $item['type']>=5&&$item['type']<=7}
                                <span class="label label-success"> {$item['type_name']}</span>
                            {else}
                                <span class="label label-default"> {$item['type_name']}</span>
                            {/if}
                            {if $item['remark']}
                            <br>
                            <span style="color: #999999">
                                     {$item['remark']}
                                </span>
                            {/if}
                        </td>
                        <td>
                            <span class="label label-info">{$item['type_num']}</span>
                        </td>
                        <td>
                            {if $item['type'] ==1 }
                            <span class="label label-info" style="background-color:{$item['link_color']};">
                                {$item['link_name']}
                            </span>
                            {/if}
                        </td>
                        <td>
                            {if $item['is_pay'] == 1 }
                            <span class="label label-success"> 已支付</span>
                            {else}
                            <span class="label label-danger">未支付</span>
                            {/if}
                            <br>
                            {if $item['sign_name']}
                            {if  $item['sign_type'] == 1}
                            <span class="label label-default">{$item['sign_name']}</span>
                            {elseif $item['sign_type'] == 2}
                            <span class="label label-default">{$item['sign_name']}</span>
                            {elseif $item['sign_type'] == 3}
                            <span class="label label-default">{$item['sign_name']}</span>
                            {elseif $item['sign_type'] == 4}
                            <span class="label label-default">{$item['sign_name']}</span>
                            {/if}
                            {/if}
                        </td>
                        <td>
                            {if $item['worker'] }
                            {$item['worker']}
                            {/if}
                        </td>
                        <td style="font-size: 10px;">
                            {php echo str_replace(' ','<br>',$item['create_time']);}{if !empty($system['wxapp'])}<br>{php echo strpos($item['post'],"version")!==false?'小程序':'H5链接';}{/if}
                        </td>
                        {if $_G['isSuperAdmin']}
                        <td style="text-align: right">
                            <input type="hidden" id="url_{$item['id']}" value="{$item['url']}">
                            <input type="hidden" id="post_{$item['id']}" value="{php echo htmlentities($item['desc']) ;}">
                            <button  class="btn btn-info btn-sm" onclick="showInfo({$item['id']})" title="查看详情" data-toggle="tooltip" data-placement="top">
                                <i class="fa fa-list"> </i></button>
                        </td>
                        {/if}
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<div class="tts"  id="infoContent" style="display: none;">
    <div class="panel-body">
        <div class="form-group">
            <div class="col-sm-12 col-xs-12" style="background-color:#999;font-size:16px;color: #fff;word-wrap:break-word;padding: 10px;">
                <span id="url" ></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12 col-xs-12" style="padding: 10px">
                <div  id="postdata" ></div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    function jump(){
        layer.msg('正在准备下载');
    }
    function submitForm(){
        let tmp_do = 'record';
        $("#do").val(tmp_do);
        var form = document.getElementById("myform");
        form.submit();
    }

   function showInfo(id){
        infoOpen = layer.open({
            type: 1,
            title: false,
            closeBtn: 1,
            anim: 2,
            shadeClose: true,
            area: ['800px','70%'],
            content: $("#infoContent"),
            btn: false,
            zIndex: 1000,
            success: function (layero, index) {
                  let postdata = $('#post_'+id).val();
                  $('#url').text($('#url_'+id).val());
                 $('#postdata').html(postdata);
            }
        });
    }
</script>
{$pager}
